import { fileURLToPath, URL } from 'node:url';

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite';

// https://vitejs.dev/config/
export default defineConfig({
  base: '/pc',
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue']
    })
  ],
  resolve: {
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    host: '0.0.0.0',
    port: 2024,
    proxy: {
      '/api': {
        // target: 'http://175.6.148.184:18001/',
        target: 'http://8.134.253.122:18001/',
        // target: 'http://8.134.253.122:18001/',
        // target: 'http://gpu.sslvip.net/',
        // target: 'https://r.rjkj7.com/',
        changeOrigin: true
        // rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
});
